/*
 * @Author: benchu 
 * @Date: 2020-12-06 21:58:52 
 * @Last Modified by: mikey.zhaopeng
 * @Last Modified time: 2020-12-16 22:25:35
 */

const { Controller, Subscription } = require('egg');

module.exports = class RedisTestController extends Controller {

    //* 创建key
    async createKey() {
        const { ctx, app } = this
        try {
            await app.redis.set('userName', '123')
        } catch (error) {
            console.log(error)
        }
        ctx.body = await this.app.redis.get('userName')
    }

    //* 获取key
    async getKey() {
        this.ctx.body = await this.app.redis.get('userName')
    }

}

